
import java.util.HashMap;
import java.util.Map;

/**
 * Created by forcht on 2018/4/30.
 */
public class Solution {
    public int[] twoSum(int[] numbers, int target) {
        int[] index=new int[2];
        Map<Integer,Integer> map=new HashMap<>();
        for(int i=0;i<numbers.length;i++){
            map.put(numbers[i],i);
        }
        for(int i=0;i<numbers.length;i++){
            Integer integer = map.get(target - numbers[i]);
            if(integer!=null&&i!=integer){
                index[0]=i+1;
                index[1]=integer+1;
                break;
            }
        }
        return index;
    }
}
